package hr.controllers;

import hr.dao.EmployeeDao;
import hr.models.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: VMoskalenko
 * Date: 25.06.12
 * Time: 20:35
 */
@Controller
public class EmployeeListController {

    @Autowired
    private EmployeeDao employeeDao;

    @RequestMapping(value = "/employee/list", method = RequestMethod.GET)
    public String list(HttpServletRequest request) {
        List<Employee> employeeList = employeeDao.all();
        request.setAttribute("employeeList", employeeList);
        return "employee_list";
    }

}
